﻿@model List<kxcxw.Data.Entities.SysItemDetial>
@using kxcxw.Data.Entities;
@using kxcxw.Data.Common;
@{
    ViewBag.Title = "类别管理";
    Layout = "~/Areas/Admin/Views/Shared/_DictLayout.cshtml";
    CommonRepositories comm = new CommonRepositories();
}
<h2>
    @Html.ActionLink("大类管理", "Index") &raquo; @Html.ActionLink("修改类别信息", "Edit", null, new { @class = "active" })</h2>
<div id="main">
    <table>
        <tr>
            <th style="width: 20%">
                类别名
            </th>
            <th style="width: 40%">
                简介
            </th>
            <th style="width: 10%">
                产品数
            </th>
            <th style="width: 20%">
                序号
            </th>
            <th style="width: 10%">
                修改
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td style="color:Black;">
                    【@item.itemDetialName】
                </td>
                <td>
                    @item.Description
                </td>
                <td>
                    @comm.getProductListByCategory(item.ItemDeitalID).Count()
                </td>
                <td>
                    @item.OrderID
                </td>
                <td>
                    @Html.ActionLink("[修改]", "CategoryEdit", new { id = item.ItemDeitalID }, new { @class = "edit", target = "_blank" })
                </td>
            </tr>
               List<SysItemDetial> list = (List<SysItemDetial>)ViewData[item.ItemDeitalID];
               if (list.Count() > 0)
               {
                   foreach (var item2 in list)
                   {
                        <tr>
                            <td>
                                 |----- @item2.itemDetialName
                            </td>
                            <td>
                                @item2.Description
                            </td>
                            <td>
                                @comm.getProductListByCategory(item2.ItemDeitalID).Count()
                            </td>
                            <td>
                                @item2.OrderID
                            </td>
                            <td>
                                @Html.ActionLink("修改", "CategoryEdit", new { id = item2.ItemDeitalID }, new { @class = "edit"})
                            </td>
                        </tr>  
                   }
               }
        }
    </table>
</div>
